package com.aidex.biz.service.impl;

import com.aidex.biz.domain.LoanBill;
import com.aidex.biz.mapper.LoanBillMapper;
import com.aidex.biz.service.LoanBillService;
import com.aidex.common.annotation.DataScope;
import com.aidex.common.core.service.BaseServiceImpl;
import com.aidex.common.utils.NumberUtils;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 还款信息Service业务层处理
 *
 * @author sean
 * @email 2074844820@qq.com
 * @date 2025-07-03
 */
@Service
@Transactional(readOnly = true)
public class LoanBillServiceImpl extends BaseServiceImpl<LoanBillMapper, LoanBill> implements LoanBillService {
    private static final Logger log = LoggerFactory.getLogger(LoanBillServiceImpl.class);

    /**
     * 获取单条数据
     *
     * @param loanBill 还款信息
     * @return 还款信息
     */
    @Override
    public LoanBill get(LoanBill loanBill) {
        LoanBill dto = super.get(loanBill);
        return dto;
    }

    /**
     * 获取单条数据
     *
     * @param id 还款信息id
     * @return 还款信息
     */
    @Override
    public LoanBill get(String id) {
        LoanBill dto = super.get(id);
        return dto;
    }


    /**
     * 查询还款信息列表
     *
     * @param loanBill 还款信息
     * @return 还款信息
     */
    @Override
    @DataScope(userAlias = "a", deptAlias = "a")
    public List<LoanBill> findList(LoanBill loanBill) {
        return super.findList(loanBill);
    }

    /**
     * 分页查询还款信息列表
     *
     * @param loanBill 还款信息
     * @return 还款信息
     */
    @Override
    @DataScope(userAlias = "a", deptAlias = "a")
    public PageInfo<LoanBill> findPage(LoanBill loanBill) {
        return super.findPage(loanBill);
    }

    /**
     * 保存还款信息
     *
     * @param loanBill
     * @return 结果
     */
    @Override
    public boolean save(LoanBill loanBill) {
        return super.save(loanBill);
    }


    /**
     * 删除还款信息信息
     *
     * @param loanBill
     * @return 结果
     */
    @Override
    public boolean remove(LoanBill loanBill) {
        return super.remove(loanBill);
    }

    /**
     * 批量删除还款信息
     *
     * @param ids 需要删除的还款信息ID
     * @return 结果
     */
    @Transactional(readOnly = false)
    @Override
    public int deleteLoanBillByIds(String[] ids) {
        return mapper.deleteLoanBillByIds(ids);
    }

    /**
     * 获取最大编号
     *
     * @param loanBill 还款信息
     * @return 结果
     */
    @Override
    public int findMaxSort(LoanBill loanBill) {
        return NumberUtils.nextOrder(mapper.findMaxSort(loanBill));
    }

    @Transactional(readOnly = false)
    @Override
    public int updateOverDue(String id) {
        return mapper.updateOverDue(id);
    }

    @Transactional(readOnly = false)
    @Override
    public LoanBill findOne(LoanBill loanBill) {
        return mapper.findOne(loanBill);
    }

    @Override
    public int deleteById(String id) {
        return mapper.deleteById(id);
    }
}
